<template>
    <div class="poster">
        <div class="img">
            <img :src="imgurl" alt="">
        </div>
        <div @click="downloadCodeImg" class="poster-bottom flex-center"> 保存到相册</div>
    </div>
</template>

<script>
    export default {
        name: "poster",
        data(){
            return {
                imgurl:""
            }
        },
        mounted() {

            this.$http.post('user/getShare',{}).then(res=>{
                this.imgurl = res.data;
            })
            document.addEventListener('plusready', onPlusReady, false);
        },
        methods:{
            downloadCodeImg(){
                if(window.plus){
                    plus.gallery.save( this.imgurl,  ()=> {
                        this.$toast('保存成功')
                    } );
                }
            },
        }
    }
</script>

<style scoped lang="less">
    .poster{
        .img{
            width: 506px;
            margin: 10vh auto;
            img{
                width: 100%;
            }
        }
    }
    .poster-bottom{
        position: fixed;
        bottom:0;
        width: 100%;
        font-size: 32px;
        color: #efd7b9;
        height: 98px;
        background-color: #171518;
    }
</style>
